package question.solution27;

import question.SolutionTemplate;

import java.util.LinkedList;
import java.util.List;

public class Solution27 implements SolutionTemplate {

    public int removeElement(int[] nums, int val) {
        if(nums.length == 0){
            return 0;
        }

        int pl = 0;
        int pr = 0;
        while(pr < nums.length){
            if(nums[pr] != val){
                nums[pl] = nums[pr];
                pl++;
            }
            pr++;
        }
        return pl;
    }

    public void test() {
        int[] nums = {3,2,2,3};
        int result = removeElement(nums, 3);
        int[] num2 = {3};
        result = removeElement(num2, 3);
        int[] num3 = {0};
        result = removeElement(num3, 3);
        return;
    }
}
